<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/1/13
 * Time: 21:04
 */
define("PHP_IN",true);
require "../include/init.php";

$act = isset($_GET['act']) ? trim($_GET['act']) : "";
$newsid = isset($_GET['newsid']) ? intval($_GET['newsid']) : 0;

$isdispaly = isset($_GET['isdisplay']) ? intval($_GET['isdisplay']) : 0;


$title = isset($_GET['title']) ? trim($_GET['title']) : "";

if($act == "title"){
    $sql = "UPDATE news SET title='$title' WHERE newsid =".$newsid;
    $result = $db->query($sql);
    if($result){
        echo $title;
    }else{
        echo "修改失败";
    }
}elseif($act == "isdisplay"){

    $sql = "UPDATE news SET isdisplay='$isdispaly' WHERE newsid =".$newsid;
    //echo $sql;die;
    $result = $db->query($sql);
    if($result){
        echo $isdispaly==1 ? "是":"否";
    }else{
        echo "修改失败";
    }
}
